package joodle.ui;
/**
 * Represents the status of the shape which resides below the canvas
 */
import java.awt.Dimension;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class StatusPanel extends JPanel {

	JLabel label;
	JLabel coord;
	
	private static StatusPanel instance = new StatusPanel();
	
	public static StatusPanel instance() {
		return instance;
	}
	
	private StatusPanel() {
		setPreferredSize(new Dimension(Short.MAX_VALUE, 40));
		//setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
		setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
		
		label = new JLabel("Ready");
		add(label);
		
		add(Box.createHorizontalGlue());
		
		coord = new JLabel();
		add(coord);
		
		add(Box.createHorizontalStrut(25));
	}
	/**
	 * Sets the new status with the given string
	 * @param s the string that will take place
	 */
	public void setStatusMessage(String s) {
		label.setText(s);
	}

	public void setStatusCoord(int x, int y) {
		coord.setText(String.format("x=%d, y=%d", x, y));
	}
}
